package Chapter8_polymorphism;

/**
 * Date: 2019/2/19
 * Time: 21:18
 * User: Driss.
 */

class Meal{
    Meal(){
        System.out.print("Meal()");
    }
}

class Bread{
    Bread(){
        System.out.print("Bread()");
    }
}

class Cheese{
    Cheese(){
        System.out.print("Cheese()");
    }
}

class Lettuce{
    Lettuce(){
        System.out.print("Lettuce()");
    }
}

class Lunch extends Meal{
    Lunch(){
        System.out.print("Lunch()");
    }
}

class PortableLunch extends Lunch{
    PortableLunch(){
        System.out.print("PortablLunch()");
    }
}

public class Sandwich extends PortableLunch {
    private Bread b = new Bread();
    private Cheese c = new Cheese();
    private Lettuce l = new Lettuce();
    public Sandwich(){
        System.out.println("SandWich()");
    }

    public static void main(String[] args) {
        new Sandwich();
    }
}

